SET(TARGET_NAME EDesignerLib)
#PROJECT(${TARGET_NAME})
#必须要有的宏定义
#ADD_DEFINITIONS (-DdebugWidgetDataBase)
ADD_DEFINITIONS (-DQDESIGNER_SDK_LIBRARY)

#INCLUDE_DIRECTORIES("..\\..\\include")
#LINK_DIRECTORIES("..\\..\\lib")
IF (CMAKE_CL_64)
ELSE()
ENDIF()

	INCLUDE_DIRECTORIES( ${LUA_DIR}/include)
	LINK_DIRECTORIES( ${LUA_DIR}/lib)
	
	INCLUDE_DIRECTORIES( ${PROJECT_SOURCE_DIR}/${TARGET_NAME}/include)
	#INCLUDE_DIRECTORIES( ${PROJECT_SOURCE_DIR}/${TARGET_NAME}/include/objectinspector)
	INCLUDE_DIRECTORIES( ${PROJECT_SOURCE_DIR}/${TARGET_NAME})
	INCLUDE_DIRECTORIES( ${PROJECT_SOURCE_DIR}/${TARGET_NAME}/shared)
	INCLUDE_DIRECTORIES( ${PROJECT_SOURCE_DIR}/${TARGET_NAME}/shared/qtpropertybrowser)
        INCLUDE_DIRECTORIES( ${PROJECT_BINARY_DIR}/${TARGET_NAME})#为了ui生成的头文件
        INCLUDE_DIRECTORIES( ${PROJECT_BINARY_DIR}/${TARGET_NAME}/shared/qtpropertybrowser)#为了moc生成的头文件


	INCLUDE_DIRECTORIES( ${QT_DIR}/include)
	#INCLUDE_DIRECTORIES( ${QT_DIR}/tools/shared/qtpropertybrowser)

	LINK_DIRECTORIES( ${QT_DIR}/lib)

        #INCLUDE_DIRECTORIES( ${JSON_LIB_DIR}/include)
        #LINK_DIRECTORIES( ${JSON_LIB_DIR}/lib)

        INCLUDE_DIRECTORIES( ${OPEN_THREADS}/include)
        LINK_DIRECTORIES( ${OPEN_THREADS}/lib)

        INCLUDE_DIRECTORIES( ${QUA_ZIP}/include)
        LINK_DIRECTORIES( ${QUA_ZIP}/lib)

        INCLUDE_DIRECTORIES( ${ZLIB}/include)
        LINK_DIRECTORIES( ${ZLIB}/lib)



find_package(QT4 REQUIRED)
INCLUDE (${QT_USE_FILE})
ADD_DEFINITIONS (${QT_DEFINITIONS})

FILE(GLOB QTDEMO_INCLUDE_LIST "${PROJECT_SOURCE_DIR}/${TARGET_NAME}/include_ui/*.h" )
FILE(GLOB_RECURSE ThisTarget_INCLUDE_LIST "${PROJECT_SOURCE_DIR}/${TARGET_NAME}/include/*.h")
FILE(GLOB_RECURSE ThisTarget_SRC_LIST "${PROJECT_SOURCE_DIR}/${TARGET_NAME}/src/*.cpp")



FILE(GLOB QTDEMO_UI_LIST "${PROJECT_SOURCE_DIR}/${TARGET_NAME}/ui/*.ui")
FILE(GLOB QTDEMO_RESOURCE_LIST "${PROJECT_SOURCE_DIR}/${TARGET_NAME}/resources/*.qrc")
#share文件夹
FILE(GLOB_RECURSE SHARE_INCLUDE_LIST "${PROJECT_SOURCE_DIR}/${TARGET_NAME}/shared/qtpropertybrowser/*.h" )
FILE(GLOB_RECURSE SHARE_SRC_LIST "${PROJECT_SOURCE_DIR}/${TARGET_NAME}/shared/qtpropertybrowser/*.cpp" )

source_group("include" FILES ${ThisTarget_INCLUDE_LIST})
source_group("src" FILES ${ThisTarget_SRC_LIST})

source_group("includeShare" FILES ${SHARE_INCLUDE_LIST})
source_group("srcShare" FILES ${SHARE_SRC_LIST})


source_group("ui" FILES ${QTDEMO_UI_LIST})
source_group("resource" FILES ${QTDEMO_RESOURCE_LIST})
QT4_WRAP_CPP(example_MOCS 	${ThisTarget_INCLUDE_LIST} )
QT4_WRAP_CPP(example_MOCS_Share ${SHARE_INCLUDE_LIST})#${SHARE_SRC_LIST}
#QT4_WRAP_CPP(example_MOCS_Share ${SHARE_INCLUDE_LIST})
QT4_WRAP_UI(example_UIS		${QTDEMO_UI_LIST})
QT4_ADD_RESOURCES(example_RCC_SRCS  ${QTDEMO_RESOURCE_LIST})
source_group("generated_file" FILES ${example_MOCS} ${example_UIS} ${example_RCC_SRCS} ${example_MOCS_Share})

#库文件在debug下名字后面加d
SET(CMAKE_DEBUG_POSTFIX "d" CACHE STRING "add a postfix, usually d on windows")
SET(CMAKE_RELEASE_POSTFIX "" CACHE STRING "add a postfix, usually empty on windows")

ADD_LIBRARY(${TARGET_NAME} SHARED ${ThisTarget_SRC_LIST} ${SHARE_SRC_LIST} ${ThisTarget_INCLUDE_LIST} ${SHARE_INCLUDE_LIST} ${example_MOCS}  ${example_UIS}  ${example_RCC_SRCS} ${QTDEMO_INCLUDE_LIST} ${QTDEMO_UI_LIST} ${QTDEMO_RESOURCE_LIST}  )#${example_MOCS_Share}

SET(ADDITIONAL_LIBRARIES_RELEASE				
				QtXml4.lib
				QtDesignerd4.lib
                                #libjson.lib
                                OpenThreads.lib
                                quazip.lib
				)

SET(ADDITIONAL_LIBRARIES_DEBUG
				QtXmld4.lib
				QtDesigner4.lib
                                #libjsond.lib
                                OpenThreadsd.lib
                                quazipd.lib
				)
				
TARGET_LINK_LIBRARIES(${TARGET_NAME} ${QT_LIBRARIES})
TARGET_LINK_LIBRARIES(${TARGET_NAME} debug "${ADDITIONAL_LIBRARIES_DEBUG}" optimized "${ADDITIONAL_LIBRARIES_RELEASE}")

set_target_properties(${TARGET_NAME} PROPERTIES ARCHIVE_OUTPUT_DIRECTORY_RELEASE ${PROJECT_BINARY_DIR}/lib)
set_target_properties(${TARGET_NAME} PROPERTIES ARCHIVE_OUTPUT_DIRECTORY_DEBUG ${PROJECT_BINARY_DIR}/lib)
set_target_properties(${TARGET_NAME} PROPERTIES RUNTIME_OUTPUT_DIRECTORY_RELEASE ${PROJECT_BINARY_DIR}/bin)
set_target_properties(${TARGET_NAME} PROPERTIES RUNTIME_OUTPUT_DIRECTORY_DEBUG ${PROJECT_BINARY_DIR}/bin)










